// Created from GenerationTemplate
// For Decisions HL7 Engine
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Reflection;
using DecisionsFramework.Design.Properties;
using Decisions.HL7.Generated.AbstractMessage;
using Decisions.HL7.DataTypes;
using ST = System.String;
using SI = System.String;
using TX = System.String;
using FT = System.String;
using IS = System.String;
using ID = System.String;
using SNM = System.String;

namespace Decisions.HL7.Message
{
    [DataContract]
	public class RPT : AbstractDataType
    {

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("1 Repeat Pattern Code",1)]
  	    [HL7Field(HL7Version.v25, 1, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v251, 1, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v26, 1, HL7Repeat.False, HL7Required.True,"CWE")]
  	    [HL7Field(HL7Version.v27, 1, HL7Repeat.False, HL7Required.True,"CWE")]
		[RepeatPattern]
	    public CWE RepeatPatternCode {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("2 Calendar Alignment",2)]
  	    [HL7Field(HL7Version.v25, 2, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 2, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 2, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 2, HL7Repeat.False, HL7Required.True,"ID")]
		[CalendarAlignment]
	    public ID CalendarAlignment {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("3 Phase Range Begin Value",3)]
  	    [HL7Field(HL7Version.v25, 3, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v251, 3, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v26, 3, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v27, 3, HL7Repeat.False, HL7Required.True,"NM")]
	    public NM PhaseRangeBeginValue {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("4 Phase Range End Value",4)]
  	    [HL7Field(HL7Version.v25, 4, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v251, 4, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v26, 4, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v27, 4, HL7Repeat.False, HL7Required.True,"NM")]
	    public NM PhaseRangeEndValue {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("5 Period Quantity",5)]
  	    [HL7Field(HL7Version.v25, 5, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v251, 5, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v26, 5, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v27, 5, HL7Repeat.False, HL7Required.True,"NM")]
	    public NM PeriodQuantity {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("6 Period Units",6)]
  	    [HL7Field(HL7Version.v25, 6, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v251, 6, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v26, 6, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v27, 6, HL7Repeat.False, HL7Required.True,"CWE")]
	    public CWE PeriodUnits {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("7 Institution Specified Time",7)]
  	    [HL7Field(HL7Version.v25, 7, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 7, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 7, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 7, HL7Repeat.False, HL7Required.True,"ID")]
		[YesnoIndicator]
	    public ID InstitutionSpecifiedTime {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("8 Event",8)]
  	    [HL7Field(HL7Version.v25, 8, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v251, 8, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v26, 8, HL7Repeat.False, HL7Required.True,"ID")]
  	    [HL7Field(HL7Version.v27, 8, HL7Repeat.False, HL7Required.True,"ID")]
		[EventRelatedPeriod]
	    public ID Event {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("9 Event Offset Quantity",9)]
  	    [HL7Field(HL7Version.v25, 9, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v251, 9, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v26, 9, HL7Repeat.False, HL7Required.True,"NM")]
  	    [HL7Field(HL7Version.v27, 9, HL7Repeat.False, HL7Required.True,"NM")]
	    public NM EventOffsetQuantity {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("10 Event Offset Units",10)]
  	    [HL7Field(HL7Version.v25, 10, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v251, 10, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v26, 10, HL7Repeat.False, HL7Required.True,"IS")]
  	    [HL7Field(HL7Version.v27, 10, HL7Repeat.False, HL7Required.True,"CWE")]
	    public CWE EventOffsetUnits {get;set;}

        /// -----------------------------
        /// -----------------------------
		[DataMember]
    	[PropertyClassification("11 General Timing Specification",11)]
  	    [HL7Field(HL7Version.v25, 11, HL7Repeat.False, HL7Required.True,"GTS")]
  	    [HL7Field(HL7Version.v251, 11, HL7Repeat.False, HL7Required.True,"GTS")]
  	    [HL7Field(HL7Version.v26, 11, HL7Repeat.False, HL7Required.True,"GTS")]
  	    [HL7Field(HL7Version.v27, 11, HL7Repeat.False, HL7Required.True,"GTS")]
	    public GTS GeneralTimingSpecification {get;set;}





		public override string GetER7(HL7ParserOptions options) {
			List<string> dataTypeParts = new List<string>();
			dataTypeParts.Add(GetER7TextForDataPart(RepeatPatternCode, options));
		    dataTypeParts.Add(CalendarAlignment);
			dataTypeParts.Add(GetER7TextForDataPart(PhaseRangeBeginValue, options));
			dataTypeParts.Add(GetER7TextForDataPart(PhaseRangeEndValue, options));
			dataTypeParts.Add(GetER7TextForDataPart(PeriodQuantity, options));
			dataTypeParts.Add(GetER7TextForDataPart(PeriodUnits, options));
		    dataTypeParts.Add(InstitutionSpecifiedTime);
		    dataTypeParts.Add(Event);
			dataTypeParts.Add(GetER7TextForDataPart(EventOffsetQuantity, options));
			dataTypeParts.Add(GetER7TextForDataPart(EventOffsetUnits, options));
			dataTypeParts.Add(GetER7TextForDataPart(GeneralTimingSpecification, options));
			return CleanUpTrailingComponentSeps(string.Join("" + options.ComponentSep, dataTypeParts.ToArray()), options);
		}
    }
}

